home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1995, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
-
- /* letterF.c
- * Draws the bitmapped letter F on the screen (several times).
- * This demonstrates use of the glBitmap() call.
- */
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glut.h>
-
- #include <math.h>
- #include <stdio.h>
-
- /* Function Prototypes */
-
- GLvoid initgfx( GLvoid );
- GLvoid drawScene( GLvoid );
- GLvoid reshape( GLsizei, GLsizei );
- GLvoid keyboard( GLubyte, GLint, GLint );
-
- /* Global Definitions */
-
- #define KEY_ESC 27 /* ascii value for the escape key */
-
- /* Global Variables */
-
- static GLsizei winWidth, winHeight;
-
- static GLubyte letterF[64] = {
- 0xc0, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0xff, 0xc0, 0x00, 0x00,
- 0xff, 0xc0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
- GLvoid
- main ( int argc, char *argv[])
- {
- GLsizei width, height;
-
- glutInit( &argc, argv );
-
- width = glutGet(GLUT_SCREEN_WIDTH);
- height = glutGet(GLUT_SCREEN_HEIGHT);
- winWidth = width / 2;
- winHeight = height / 2;
- glutInitWindowPosition( width / 4, height / 4);
- glutInitWindowSize( winWidth, winHeight );
- glutInitDisplayMode( GLUT_RGBA );
- glutCreateWindow( argv[0] );
-
- glutKeyboardFunc( keyboard );
- glutReshapeFunc( reshape );
- glutDisplayFunc( drawScene );
-
- glutMainLoop();
- }
-
- void
- initgfx( void )
- {
- glClearColor( 0.0, 0.0, 0.0, 1.0 );
- }
-
- GLvoid
- keyboard( GLubyte key, GLint x, GLint y )
- {
- switch (key) {
- case KEY_ESC: /* Exit whenever the Escape key is pressed */
- exit(0);
- }
- }
-
- GLvoid
- reshape( GLsizei width, GLsizei height )
- {
- glViewport( 0, 0, width, height );
-
- winWidth = width;
- winHeight = height;
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- gluOrtho2D( 0.0, (GLdouble) width, 0.0, (GLdouble) height );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.375, 0.375, 0.0 );
- }
-
- GLvoid
- drawScene( GLvoid )
- {
- GLsizei width, height;
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( 1.0, 1.0, 1.0 );
- glRasterPos2i( winWidth/2, winHeight/2 );
- glBitmap( 10, 12, 0.0, 0.0, 12.0, 0.0, letterF );
- glBitmap( 10, 12, 0.0, 0.0, 12.0, 0.0, letterF );
- glBitmap( 10, 12, 0.0, 0.0, 12.0, 0.0, letterF );
- glFlush();
- }
-